<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>商品管理</title>
</head>
<body>
<div layout:fragment="content">
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a href="index.html" th:href="@{'/promotion/creditgoodsgoods/index/'+${creditGoodsId}}" id="sample_editable_1_new" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form">
				<form role="form" th:action="@{'/promotion/creditgoodsgoods/save/'+${creditGoodsId}}" th:object="${spg}" id="spForm" method="post" class="form-horizontal">
					<h4 class="form-section">商品信息</h4>
					<input type="hidden" th:field="*{id}" />
					<div class="form-body">
						<div class="form-group">
							<label class="control-label col-md-3">商品名称</label>							
							<div class="col-md-4">
								<div th:text="${spg.goods.name}"></div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3">限购数量<span class="required" aria-required="true">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="限购数量" th:field="*{limitNumber}"/>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3">积分值<span class="required" aria-required="true">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="积分值" th:field="*{credit}"/>
							</div>
						</div>
						<div th:if="${creditGoods.creditType.description} == '积分加现金购'" class="form-group">
							<label class="control-label col-md-3">现金<span class="required" aria-required="true">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="现金" th:field="*{money}"/>
							</div>
						</div>
						<!--<div class="form-group">
							<label class="control-label col-md-3">是否积分好礼<span class="required" aria-required="true">* </span></label>
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input type="radio" name="isShow"  id="optionsRadios4" value="1" checked="" th:field="*{creditType}" /></span> 是</label>
									<label class="radio-inline"><span><input type="radio" name="isShow" id="optionsRadios5" value="0" th:field="*{creditType}" /></span> 否</label>
								</div>
							</div>
						</div>-->
						<div class="form-group">
							<label class="control-label col-md-3">是否可兑换<span class="required" aria-required="true">* </span></label>							
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input type="radio" name="isShow"  id="optionsRadios4" value="1" checked="" th:field="*{isExchange}" /></span> 是</label>
									<label class="radio-inline"><span><input type="radio" name="isShow" id="optionsRadios5" value="0" th:field="*{isExchange}" /></span> 否</label>
								</div>						
							</div>
						</div>

					</div>
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button id="bt_submit" type="submit" class="btn blue">提交</button>
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</div>	
</body>
</html>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function() {
        $("#spForm").validate({
            rules: {
                limitNumber: {
                    required: true,
                    digits:true,
                    min:0,
                    max:10000
                },
                credit: {
                    required: true,
                    digits:true,
                    min:1,
                    max:10000
                },
                money: {
                    required: true,
                    number:true,
                    min:0,
                    max:99999999.99
                }
            },
            messages: {
                limitNumber: {
                    required: "请输入限购数量"
                },
                credit: {
                    required: "请输入积分"
                },
                money: {
                    required: "请输入现金金额"
                }
            }
        });
    });
    /*]]>*/
</script>